//	---------------------------------------------------------------------------
//	dark-matter-data
//	Copyright (c) 2014 dark-matter-data committers
//	---------------------------------------------------------------------------
//	This program is free software; you can redistribute it and/or modify it
//	under the terms of the GNU Lesser General Public License as published by the
//	Free Software Foundation; either version 3 of the License, or (at your
//	option) any later version.
//	This program is distributed in the hope that it will be useful, but WITHOUT
//	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
//	more details.
//	You should have received a copy of the GNU Lesser General Public License along
//	with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
//	---------------------------------------------------------------------------
package org.dmd.gpb.tools.protoparsing.generated.dmw;

// Generated from: org.dmd.util.codegen.ImportManager.getFormattedImports(ImportManager.java:82)
// Called from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:442)
import org.dmd.dmc.*;                                                          // If any attributes - (BaseDMWGenerator.java:1087)
import org.dmd.dmc.definitions.DmcDefinitionIF;                                // The object is a domain specific definition - (BaseDMWGenerator.java:411)
import org.dmd.dmc.types.DefinitionName;                                       // Is named by - (BaseDMWGenerator.java:1062)
import org.dmd.dms.ClassDefinition;                                            // Passing derived class def up the hierarchy - (BaseDMWGenerator.java:1067)
import org.dmd.gpb.tools.protoparsing.extended.ProtoDefinition;                // Derived class - (BaseDMWGenerator.java:1248)
import org.dmd.gpb.tools.protoparsing.extended.ProtoElement;                   // Required for getModificationRecorder() - (BaseDMWGenerator.java:1076)
import org.dmd.gpb.tools.protoparsing.extended.ProtoMessage;                   // Is reference type - (BaseDMWGenerator.java:1107)
import org.dmd.gpb.tools.protoparsing.generated.dmo.ProtoElementDMO;           // Abstract class - (BaseDMWGenerator.java:1230)
import org.dmd.gpb.tools.protoparsing.generated.types.ProtoMessageREF;         // Is reference type REF - (BaseDMWGenerator.java:1115)



/**
 * The ProtoElement provides a common base for all elements that \n comprise
 * a .proto specification.
 * <P>
 * Generated from the dmdproto schema at version unknown
 * <P>
 * This code was auto-generated by the dmggenerator utility and shouldn't be alterred manually!
 * Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:479)
 */
abstract public class ProtoElementDMW extends ProtoDefinition implements DmcDefinitionIF, DmcNamedObjectIF {

    protected ProtoElementDMW() {
        super();
    }

    abstract public ProtoElement getModificationRecorder();

    public ProtoElementDMO getDMO() {
        return((ProtoElementDMO) core);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:642)
    protected ProtoElementDMW(ProtoElementDMO obj, ClassDefinition cd) {
        super(obj,cd);
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.getAccessFunctions(BaseDMWGenerator.java:1297)
    public DefinitionName getObjectName(){
        return(((ProtoElementDMO) core).getName());
    }

    public int hashCode(){
        return(getObjectName().hashCode());
    }

    public DmcAttribute<?> getObjectNameAttribute(){
        return(((ProtoElementDMO) core).getObjectNameAttribute());
    }

    public boolean equals(Object obj){
        if (obj instanceof ProtoElementDMW){
            return( getObjectName().equals( ((ProtoElementDMW) obj).getObjectName()) );
        }
        return(false);
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public String getGenerateAs(){
        return(((ProtoElementDMO) core).getGenerateAs());
    }

    /**
     * Sets generateAs to the specified value.
     * @param value A value compatible with DmcTypeString
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setGenerateAs(Object value) throws DmcValueException {
        ((ProtoElementDMO) core).setGenerateAs(value);
    }

    /**
     * Sets generateAs to the specified value.
     * @param value String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setGenerateAs(String value){
        ((ProtoElementDMO) core).setGenerateAs(value);
    }

    /**
     * Removes the generateAs attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remGenerateAs(){
        ((ProtoElementDMO) core).remGenerateAs();
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public DefinitionName getName(){
        return(((ProtoElementDMO) core).getName());
    }

    /**
     * Sets name to the specified value.
     * @param value A value compatible with DmcTypeDefinitionName
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setName(Object value) throws DmcValueException {
        ((ProtoElementDMO) core).setName(value);
    }

    /**
     * Sets name to the specified value.
     * @param value DefinitionName
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setName(DefinitionName value){
        ((ProtoElementDMO) core).setName(value);
    }

    /**
     * Removes the name attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remName(){
        ((ProtoElementDMO) core).remName();
    }

    /**
     * @return A ProtoMessage object.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1434)
    public ProtoMessage getParentMessage(){
        ProtoMessageREF ref = ((ProtoElementDMO) core).getParentMessage();
        if (ref == null)
            return(null);
        
        if (ref.getObject() == null)
            return(null);
        
        return((ProtoMessage)ref.getObject().getContainer());
    }

    /**
     * Sets the parentMessage to the specified value.
     * @param value A value compatible with ProtoMessageREF
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1519)
    public void setParentMessage(ProtoMessage value) {
        ((ProtoElementDMO) core).setParentMessage(value.getDMO());
    }

    /**
     * Sets the parentMessage to the specified value.
     * @param value A value compatible with ProtoMessageREF
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1528)
    public void setParentMessage(Object value) throws DmcValueException {
        ((ProtoElementDMO) core).setParentMessage(value);
    }

    /**
     * Removes the parentMessage attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remParentMessage(){
        ((ProtoElementDMO) core).remParentMessage();
    }


}
